=========================================================================== BBS: The Abacus * HST/DS * Potterville, MI Date: 06-08-93 (03:04) Number: 202 From: RICH GELDREICH Refer#: NONE To: CALVIN FRENCH Recvd: NO Subj: Gif Loader/2 Conf: (35) Quick Basi --------------------------------------------------------------------------- '>>> Start of page 2. LOOP WHILE A = 0 'loop while byte fetched is zero SELECT CASE A CASE 44 'We've found an image descriptor! EXIT DO CASE 59 'GIF trailer, stop decoding. GOTO AllDone CASE IS <> 33 PRINT "Unknown GIF extension type.": END END SELECT 'Skip by blocked extension data. GOSUB GetByte DO: GOSUB GetByte: A$ = SPACE$(A): GET #1, , A$: LOOP UNTIL_ A = 0 LOOP 'Get image's start coordinates and size. GET #1, , XStart: GET #1, , YStart: GET #1, , XLength: GET #1, ,_ YLength XEnd = XStart + XLength: YEnd = YStart + YLength 'Check for local colormap, and fetch it if it exists. GOSUB GetByte IF (A AND 128) THEN NoPalette = 0 NumColors = 2 ^ ((A AND 7) + 1) P$ = SPACE$(NumColors * 3): GET #1, , P$ END IF 'Check for interlaced image. Interlaced = (A AND 64) > 0: PassNumber = 0: PassStep = 8 'Get LZW starting code size. GOSUB GetByte 'Calculate clear code, end of stream code, and first free LZW code. ClearCode = 2 ^ A EOSCode = ClearCode + 1 FirstCode = ClearCode + 2: NextCode = FirstCode StartCodeSize = A + 1: CodeSize = StartCodeSize 'Find maximum code for the current code size. StartMaxCode = 2 ^ (A + 1) - 1: MaxCode = StartMaxCode BitsIn = 0: BlockSize = 0: BlockPointer = 1 X = XStart: y = YStart: YBase = y * 320& 'Set screen 13 in not set yet. IF FirstTime = 0 THEN 'Go to VGA mode 13 (320x200x256). SCREEN 13: DEF SEG = &HA000 END IF 'Set palette, if there was one. IF NoPalette = 0 THEN 'Use OUTs for speed. OUT &H3C8, 0 FOR A = 1 TO NumColors * 3: OUT &H3C9, ASC(MID$(P$, A, 1)) \_ 4: NEXT 'Save palette of image to disk. 'OPEN "pal." FOR BINARY AS #2: PUT #2, , P$: CLOSE #2 END IF IF FirstTime = 0 THEN 'Clear entire screen to background color. This isn't 'done until the image's palette is set, to avoid flicker 'on some GIFs. LINE (0, 0)-(319, 199), Background, BF FirstTime = -1 END IF 'Decode LZW data stream to screen. DO 'Retrieve one LZW code. GOSUB GetCode 'Is it an end of stream code? IF Code <> EOSCode THEN 'Is it a clear code? (The clear code resets the sliding 'dictionary - it *should* be the first LZW code present ' in 'the data stream.) '>>> Continued on page 3 --- MsgToss 2.0b * Origin: Computer Co-Op - Voorhees, NJ | Ted Hare (1:266/29) SEEN-BY: 1/211 11/2 4 13/13 101/1 108/89 109/25 110/69 114/5 123/19 124/1 SEEN-BY: 153/752 154/40 77 157/110 159/100 125 430 575 950 203/23 209/209 SEEN-BY: 261/1023 280/1 390/1 396/1 15 397/2 2230/100 2440/5 3603/20